course outline
Abstract
High quality automated unit tests are one of the key development practices that enable incremental development and delivery of software. XUnit is the generic name given to the family of tools/frameworks used by developers when developing automated unit tests. JUnit, NUnit, MsTest and CppUnit are some of the better known members of the family.
This 2 or 3 day course provides the participants with a vocabulary of test smells and patterns with which to elevate their craft when writing test code. These smells give them a way to reason about the quality of their test code as well as a set of reusable test code design patterns that can be used to eliminate the smells. It also describes techniques for choosing the right set of tests and how to organize the test code including naming standards.
While the course is designed to be equally applicable to test-driven and test-after styles of development, the interplay between when the tests are written and how the system is designed for testability (and how this impacts one's test automation strategy) is highlighted to help participants to make an informed choice.
Benefits
The participant should finish with a better understanding of why automated unit tests help us build better quality software with a lower life-cycle cost and how to design and code the tests to achieve this outcome in a consistent and predictable fashion.
Course Content
Testing for Developers with xUnit introduces basic testing and test automation techniques, including:
- How to think like a tester.
- How to determine what tests to write.
- How to use the xUnit testing framework.
- Techniques for making tests maintainable.
- Techniques for improving test coverage
The 2-day course consists of 10 modules covering a broad range of topics concluding with testing indirect inputs and outputs. The 3 day course adds modules on Design-for-Testability, Testing Legacy Code and Test-Driven Development. A more detailed outline is available in http://outline.xunittraining.com. While the course is largely process agnostic, that is, it applies equally well to Test-Driven Development and Test-After Development, it does talk about the advantages of automating tests before the software is written and debugged.
Each module starts with a presentation on the topic followed by a hands-on exercise. Participants are strongly urged to work in pairs as this results in faster learning and less frustration. Each exercise is followed by a discussion about what was experienced during the exercise. Time is split roughly 50/50 between theory/presentation/discussion and hands-on test coding exercises. The exercises are currently available in Java, C# and C++. Additional languages could be added given sufficient demand.
For on-site delivery, the standard course can be customized to suit your specific needs. For example, it can augmented with additional modules on advanced topics such as Test Strategy, and Data-Driven Tests as described in Gerard's book, "xUnit Test Patterns-Refactoring Test Code" and with modules on using tools such as FIT, JBehave or Cucumber to do keyword and data-driven functional test automation.
Prerequisites
- At least 6 months experience programming.
- Familiarity with the language of training.
- Most students will get significantly more out of this course if they already have prior experience in using an xUnit-based open-source testing framework.
Learning Objectives
Participants should leave the course with at least a basic understanding of:
-
What is the role of automated unit testing?
- What is developer testing?
- How to "think like a tester"
- How to determine which tests to write?
- Why should I automate tests?
-
How to automate tests with XUnit
- Basic mechanics of test automation
- What tests should I automate?
- Proper use of assertions
- Testing of exceptions
- Ways to set up the test fixture and when to use which
- Use of stubs and mocks to isolate the class being tested
- Common problems and how to avoid them
- Bad smells (symptoms) and what they mean
-
How to get the best "bang" for your testing dollar
- When to write the tests
- How to verify the tests
- How to make the tests maintainable and useful as documention
- How to make tests portable (run anywhere)
- How to make tests repeatable and robust (provide consistent results even as the system evolves)
Copyright © 2003-2008 Gerard Meszaros all rights reserved